﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EntityModel;
using IRepository;
using OA.DataBase;
using System.Data;

namespace RepositoryImp
{
    public class ModuleRepository : BaseRepository<Module>, IModuleRepository
    {
        public ModuleRepository(OAContext p_dbContext)
            : base(p_dbContext)
        {
        }
        public override void Delet(Module entity)
        {
            if (dbContext.Entry(entity).State == EntityState.Detached)
            {
                dbSet.Attach(entity);
            }
            dbContext.Database.ExecuteSqlCommand(string.Format("delete dbo.Module where ParentId={0}", entity.ModuleID));
            dbSet.Remove(entity);
        }
    }
}
